package com.letoken.platform.pub.enums;

/**
 * ApiResponseCode
 *
 */
public enum ApiResponseEnum implements com.letoken.platform.pub.enums.ApiResponseCode {

    /**
     * 权限判断
     */
    SUCCESS(80000000, "success", "操作成功"),
    ERROR_001(80000001, "system error", "系统开小差"),
    ERROR_002(80000002, "parameter error", "参数错误"),
    ERROR_003(80000003, "repeated submit", "重复提交"),
    ERROR_004(80000004, "·unauthorized operation", "无权操作"),


    ERROR_005(80000005, "·unauthorized operation", "无权操作"),

    ERROR_006(80000006, "", "数据异常!"),

    ERROR_007(80000007, "", "参数缺失!"),
    ERROR_008(80000008, "", "服务异常!"),
    ERROR_009(80000009, "", "验证码失效!"),
    ERROR_010(80000010, "", "验证码错误!"),
    ;

    private int code;
    private String msg;
    private String desc;

    ApiResponseEnum(int code, String msg, String desc) {
        this.msg = msg;
        this.code = code;
        this.desc = desc;
    }


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }


    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public String getDesc() {
        return this.desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static com.letoken.platform.pub.enums.ApiResponseEnum getResponseCode(int code) {
        for (com.letoken.platform.pub.enums.ApiResponseEnum apiResponseCode : values()) {
            if (apiResponseCode.getCode() == code) {
                return apiResponseCode;
            }
        }
        return null;
    }
}
